package system;

import system.Constants.Size;
import android.content.Context;

public class Device {
	private static Context m_contex = null;
	private static int m_iWidth = 480; // default
	private static int m_iHeight = 320; // default
	public static float MENU_BUTTON_HEIGHT = 39;
	public static float MENU_BUTTON_WIDTH = 220;
	
	private static float s_fScaleFactorW = 1;
	private static float s_fScaleFactorH = 1;
	private static boolean s_bIsEnableScaleFactor = true;

	public static void SetContext(Context context) {
		m_contex = context;
	}

	public static Context GetContext() {
		return m_contex;
	}

	public static void SetSize(int w, int h) {
		m_iWidth = w;
		m_iHeight = h;
		s_fScaleFactorW = w / 480f;
		s_fScaleFactorH = h / 320f;
		ResizeMenu();
	}

	public static int GetWidth() {
		return m_iWidth;
	}

	public static int GetHeight() {
		return m_iHeight;
	}

	private static void ResizeMenu() {
		MENU_BUTTON_WIDTH = Size.MNU_ITEM_WIDTH * s_fScaleFactorW;
		MENU_BUTTON_HEIGHT = Size.MNU_ITEM_HEIGHT * s_fScaleFactorH;
	}
	
	public static float GetScaleFactorW() {
		return s_fScaleFactorW;
	}
	
	public static float GetScaleFactorH() {
		return s_fScaleFactorH;
	}
	
	public static void EnableScaleFactor(){
		s_bIsEnableScaleFactor  = true;
	}
	
	public static void DisableScaleFactor(){
		s_bIsEnableScaleFactor  = false;
	}
	
	public static boolean IsEnableScaleFactor(){
		return s_bIsEnableScaleFactor;
	}
}
